
<?php if ($total>$pageSize):?>
    <div class="turnThePage clearfix">
        <a target="_self" <?php if($page==1):?>href="javascript:;"<?php else:?>
            href="<?php if(!isset($type)&&($page-1==1)):?><?=substr($urlLeft,0,strlen($urlLeft)-6)?><?php else:?><?=$urlLeft?><?=($page-1)?><?=$urlRight?><?php endif;?>" target="_self"<?php endif;?>>
            <i class="fa fa-angle-left"></i></a>

        <?php if (ceil($total/$pageSize)>10&&$page>5&&$page<ceil($total/$pageSize)&&$page<ceil($total/$pageSize)-3):?>
            <a href="<?php if(!isset($type)):?><?=substr($urlLeft,0,strlen($urlLeft)-6)?><?php else:?><?=$urlLeft?>1<?=$urlRight?><?php endif;?>" target="_self"
               class="zxfPagenum <?php if($page==1):?>checkedPage<?php endif;?>">1</a>
            <span class="pagination-ellipsis">...</span>
            <?php for ($i=$page-2;$i<=$page;$i++):?>
                <a href="<?=$urlLeft?><?=$i?><?=$urlRight?>" target="_self" class="zxfPagenum <?php if($page==$i):?>checkedPage<?php endif;?>"><?=$i?></a>
            <?php endfor;?>
            <?php for ($i=$page+1;$i<$page+3;$i++):?>
                <a href="<?=$urlLeft?><?=$i?><?=$urlRight?>" target="_self" class="zxfPagenum <?php if($page==$i):?>checkedPage<?php endif;?>"><?=$i?></a>
            <?php endfor;?>
            <span class="pagination-ellipsis">...</span>

            <a target="_self" href="<?=$urlLeft?><?=ceil($total/$pageSize)?><?=$urlRight?>" class="prebtn"><?=ceil($total/$pageSize)?></a>


        <?php elseif (ceil($total/$pageSize)>10&&$page<=5):?>
            <a href="<?php if(!isset($type)):?><?=substr($urlLeft,0,strlen($urlLeft)-6)?><?php else:?><?=$urlLeft?>1<?=$urlRight?><?php endif;?>"
               target="_self" class="zxfPagenum <?php if($page==1):?>checkedPage<?php endif;?>">1</a>
            <?php for ($i=2;$i<=$page;$i++):?>
                <a href="<?=$urlLeft?><?=$i?><?=$urlRight?>" target="_self" class="zxfPagenum <?php if($page==$i):?>checkedPage<?php endif;?>"><?=$i?></a>
            <?php endfor;?>
            <?php for ($i=$page+1;$i<=$page+2;$i++):?>
                <a href="<?=$urlLeft?><?=$i?><?=$urlRight?>" target="_self" class="zxfPagenum <?php if($page==$i):?>checkedPage<?php endif;?>"><?=$i?></a>
            <?php endfor;?>
            <span class="pagination-ellipsis">...</span>
            <a target="_self" href="<?=$urlLeft?><?=ceil($total/$pageSize)?><?=$urlRight?>" class="prebtn"><?=ceil($total/$pageSize)?></a>

        <?php elseif (ceil($total/$pageSize)>10&&$page>=ceil($total/$pageSize)-3):?>
            <a href="<?php if(!isset($type)):?><?=substr($urlLeft,0,strlen($urlLeft)-6)?><?php else:?><?=$urlLeft?>1<?=$urlRight?><?php endif;?>"
               target="_self" class="zxfPagenum <?php if($page==1):?>checkedPage<?php endif;?>">1</a>
            <span class="pagination-ellipsis">...</span>
            <?php for ($i=$page-2;$i<=ceil($total/$pageSize);$i++):?>
                <a href="<?=$urlLeft?><?=$i?><?=$urlRight?>" target="_self" class="zxfPagenum <?php if($page==$i):?>checkedPage<?php endif;?>"><?=$i?></a>
            <?php endfor;?>
        <?php else:?>
            <a href="<?php if(!isset($type)):?><?=substr($urlLeft,0,strlen($urlLeft)-6)?><?php else:?><?=$urlLeft?>1<?=$urlRight?><?php endif;?>" target="_self" class="zxfPagenum <?php if($page==1):?>checkedPage<?php endif;?>">1</a>
            <?php for ($i=2;$i<=ceil($total/$pageSize);$i++):?>
                <a href="<?=$urlLeft?><?=$i?><?=$urlRight?>" target="_self" class="zxfPagenum <?php if($page==$i):?>checkedPage<?php endif;?>"><?=$i?></a>
            <?php endfor;?>
        <?php endif;?>

        <a <?php if($page==ceil($total/$pageSize)):?>href="javascript:;"<?php else:?>href="<?=$urlLeft?><?=($page+1)?><?=$urlRight?>" target="_self"<?php endif;?> class="nextbtn"><i class="fa fa-angle-right"></i></a>
    </div>
<?php endif;?>